package jeumpapayment;

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.XYEdges;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.RichTextField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;
import net.rim.device.api.ui.decor.BackgroundFactory;
import net.rim.device.api.ui.decor.Border;
import net.rim.device.api.ui.decor.BorderFactory;

public class RegisterReport extends MainScreen {
	private RegisterReport me;
	private final int WIDTH = JeumpaPayment.SCREEN_WIDTH; 
	private final int HEIGHT = JeumpaPayment.SCREEN_HEIGHT;
	
	public RegisterReport(){
		super();
		this.me = this;
		VerticalFieldManager manager = (VerticalFieldManager)getMainManager();
		
//======================================= Draw the background of the Register Report Screen =======================================================
		Bitmap bitmap = new Bitmap(WIDTH,HEIGHT);
		Graphics g = Graphics.create(bitmap);
		g.setColor(0x000000);
		g.fillRect(0, 0, WIDTH,HEIGHT);
		//g.setColor(0x4B3D39);
		//g.fillRoundRect(20,70,320,100,30,30); //untuk mengambar round box (20,70,320,200,30,30)
		//g.setColor(0x777474);
		//g.drawRoundRect(20,70,320,200,30,30); // untuk mengambar round box border
		g.drawBitmap(0,0,JeumpaPayment.BANNER.getWidth(),JeumpaPayment.BANNER.getHeight(), JeumpaPayment.BANNER,0,0);
		manager.setBackground(BackgroundFactory.createBitmapBackground(bitmap));
		
//==================================================================================================================================================
		
//=============================================== Draw the text area for Register Report ===========================================================
		
		// Create Text Area
		
		RichTextField registerReport = new RichTextField(){
		
			protected void paint(Graphics g){
			
			g.setColor(0xEEC900); //floralwhite
			super.paint(g);
		}
	 };
	 registerReport.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));
	 registerReport.setPadding(5,5,300,5);
	 registerReport.setMargin(65,10,0,10);
	 registerReport.setBorder(BorderFactory.createRoundedBorder(new XYEdges(10,10,10,10),0xEEC900,Border.STYLE_SOLID)); // 0x777474
	 
	 //add the text area to screen
	 add(registerReport);
	 
//====================================================================================================================================================
	 
//=================================================== Button "Lanjutkan" =============================================================================
	 
	 ButtonField buttonLanjutkan = new ButtonField("Lanjutkan");
	 buttonLanjutkan.setMargin(10,10,0,30);
		
	 buttonLanjutkan.setChangeListener(new RegisterButtonHandler());
		
	 
	 //add button to screen
	 add(buttonLanjutkan);
	}
	
	public class RegisterButtonHandler implements FieldChangeListener{

		public void fieldChanged(Field field, int context) {
			// TODO Auto-generated method stub
			JeumpaPayment.switchScreen(me, new GenerateBarcodeScreen()) ;
		}
	}

	/*
	protected boolean onSavePrompt() {
			// TODO Auto-generated method stub
		if(exit) return super.onSavePrompt();
		return false;
		}
		*/
}






